MailLogger (Apache Ant API)

org.apache.tools.ant.listener

## Class MailLogger

- java.lang.Object
- - org.apache.tools.ant.DefaultLogger
  - - org.apache.tools.ant.listener.MailLogger

- All Implemented Interfaces:
    java.util.EventListener, BuildListener, BuildLogger

      public class MailLogger
      extends DefaultLogger

  Buffers log messages from DefaultLogger, and sends an e-mail with the results. The following Project properties are used to send the mail.
  - MailLogger.mailhost [default: localhost] - Mail server to use
  - MailLogger.port [default: 25] - Default port for SMTP
  - Maillogger.user [no default] - user name for SMTP auth (requires JavaMail)
  - Maillogger.password [no default] - password for SMTP auth (requires JavaMail)
  - Maillogger.ssl [default: false] - on or true if ssl is needed (requires JavaMail)
  - MailLogger.from [required] - Mail "from" address
  - MailLogger.from [no default] - Mail "replyto" address(es), comma-separated
  - MailLogger.failure.notify [default: true] - Send build failure e-mails?
  - MailLogger.success.notify [default: true] - Send build success e-mails?
  - MailLogger.failure.to [required if failure mail to be sent] - Address to send failure messages to
  - MailLogger.success.to [required if success mail to be sent] - Address to send success messages to
  - MailLogger.failure.cc [no default] - Address to send failure messages to carbon copy (cc)
  - MailLogger.success.to [no default] - Address to send success messages to carbon copy (cc)
  - MailLogger.failure.bcc [no default] - Address to send failure messages to blind carbon copy (bcc)
  - MailLogger.success.bcc [no default] - Address to send success messages to blind carbon copy (bcc)
  - MailLogger.failure.subject [default: "Build Failure"] - Subject of failed build
  - MailLogger.success.subject [default: "Build Success"] - Subject of successful build
  - MailLogger.failure.body [default: none] - fixed text of mail body for a failed build, default is to send the logfile
  - MailLogger.success.body [default: none] - fixed text of mail body for a successful build, default is to send the logfile
  - MailLogger.mimeType [default: text/plain] - MIME-Type of email
  - MailLogger.charset [no default] - character set of email
  - Maillogger.starttls.enable [default: false] - on or true if STARTTLS should be supported (requires JavaMail)
  - MailLogger.properties.file [no default] - Filename of properties file that will override other values.
  These properties are set using standard Ant property setting mechanisms (<property>, command-line -D, etc). Ant properties can be overridden by specifying the filename of a properties file in the MailLogger.properties.file property . Any properties defined in that file will override Ant properties.

- - ### Field Summary

    - ### Fields inherited from class org.apache.tools.ant.DefaultLogger

      `emacsMode, err, LEFT_COLUMN_SIZE, lSep, msgOutputLevel, out`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MailLogger()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `buildFinished(BuildEvent event)` Sends an e-mail with the log results.
    `protected void` | `log(java.lang.String message)` Receives and buffers log messages.

    - ### Methods inherited from class org.apache.tools.ant.DefaultLogger

      `buildStarted, extractProjectName, formatTime, getBuildFailedMessage, getBuildSuccessfulMessage, getTimestamp, messageLogged, printMessage, setEmacsMode, setErrorPrintStream, setMessageOutputLevel, setOutputPrintStream, targetFinished, targetStarted, taskFinished, taskStarted`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### MailLogger

          public MailLogger()

  - ### Method Detail

    - #### buildFinished

          public void buildFinished(BuildEvent event)

      Sends an e-mail with the log results.
      Specified by:
        `buildFinished` in interface `BuildListener`
      Overrides:
        `buildFinished` in class `DefaultLogger`
      Parameters:
        `event` - the build finished event
      See Also:
        `BuildEvent.getException()`

    - #### log

          protected void log(java.lang.String message)

      Receives and buffers log messages.
      Overrides:
        `log` in class `DefaultLogger`
      Parameters:
        `message` - the message being logger